package vn.vfriends.vbox.rest;

import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.inject.Inject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author tuancn
 */
public class ApiConfigFactory {
    
    private static final Logger logger = LoggerFactory.getLogger(ApiConfigFactory.class);
    
    @Inject
    private ApiConfigLoader loader;
    
    @Produces @ApiConfig("")
    public String getString(InjectionPoint point) {
        String property = point.getAnnotated().getAnnotation(ApiConfig.class).value();
        String valueForFieldName = loader.getProperties().getProperty(property);
        return (valueForFieldName == null) ? "" : valueForFieldName;
    }
}
